/*
 * SqlOperation.scala
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.squela
package sql

class SqlFieldOperation[T](val field: SqlField[T]) extends FieldProxy[T] with SqlField[T] {
  resource = field.resource
  var prefix: String = ""
  var sufix: String = ")"

  def max = {
    prefix = "MAX("
    this
  }
  def min = {
    prefix = "MIN("
    this
  }
  def count = {
    prefix = "COUNT("
    this
  }

  private[sql] def apply(composedName: String) = prefix + composedName + sufix
}
